The character Dot (that is, ‘.’) in the default mode, matches any character other than _______
1.caret
2.ampersand
3.percentage symbol
4.newline
Posted Date:-2022-01-02 10:13:17
The function of re.match is _______
1. Error
2.Matches a pattern anywhere in the string
3.Matches a pattern at the end of the string
4.Matches a pattern at the start of the string
Posted Date:-2022-01-02 10:35:33
The pickle module defines ______ exceptions and exports _______ classes.
1.2, 3
2.3, 4
3.3, 2
4. 4, 3
Posted Date:-2022-01-02 10:01:35
The process of pickling in Python includes:
1.conversion of a list into a datatable
2. conversion of a byte stream into Python object hierarchy
3.conversion of a Python object hierarchy into byte stream
4.conversion of a datatable into a list
Posted Date:-2022-01-02 09:56:43
What will be the output of the following Python code? re.split('[a-c]', '0a3B6', re.I)
1.Error
2. [‘a’, ‘B’]
3. [‘0’, ‘3B6’]
4.[‘a’]
Posted Date:-2022-01-02 10:27:56
What will be the output of the following Python code? sentence = 'horses are fast' regex = re.compile('(?P<animal>w+) (?P<verb>w+) (?P<adjective>w+)') matched = re.search(regex, sentence) print(matched.groups())
1. {‘animal’: ‘horses’, ‘verb’: ‘are’, ‘adjective’: ‘fast’}
2.(‘horses’, ‘are’, ‘fast’)
3. ‘horses are fast’
4. ‘are’
Posted Date:-2022-01-02 10:09:22
What will be the output of the following Python code? sentence = 'we are humans' matched = re.match(r'(.*) (.*?) (.*)', sentence) print(matched.group())
1.(‘we’, ‘are’, ‘humans’)
2.(we, are, humans)
3.(‘we’, ‘humans’)
4.‘we are humans’
Posted Date:-2022-01-02 10:07:46
What will be the output of the following Python code? re.split('mum', 'mumbai*', 1)
1. Error
2. [â€, ‘bai*’]
3. [â€, ‘bai’]
4. [‘bai*’]
Posted Date:-2022-01-02 10:31:06
What will be the output of the following Python function? re.findall("hello world", "hello", 1)
1. [“helloâ€]
2. [ ]
3.hello
4.hello world
Posted Date:-2022-01-02 10:15:15
Which of the following functions creates a Python object?
1.re.compile(str)
2.re.assemble(str)
3.re.regex(str)
4.re.create(str)
Posted Date:-2022-01-02 10:34:08
Which of the following functions raises an error when an unpicklable object is encountered by Pickler?
1.pickle.PickleError
2.pickle.PicklingError
3.pickle.UnpickleError
4.pickle.UnpicklingError
Posted Date:-2022-01-02 10:01:08
Choose the function whose output can be: <_sre.SRE_Match object; span=(4, 8), match=’aaaa’>.
1.>>> re.search(‘aaaa’, “alohaaaaâ€, 0)
2.>>> re.match(‘aaaa’, “alohaaaaâ€, 0)
3. >>> re.match(‘aaa’, “alohaaaâ€, 0)
4.>>> re.search(‘aaa’, “alohaaaâ€, 0)
Posted Date:-2022-01-02 10:15:42
If __getstate__() returns _______________ the __setstate__() module will not be called on pickling.
1.True value
2.False value
3.ValueError
4.OverflowError
Posted Date:-2022-01-02 10:02:33
Lambda functions cannot be pickled because:
1.Lambda functions only deal with binary values, that is, 0 and 1
2.Lambda functions cannot be called directly
3.Lambda functions cannot be identified by the functions of the pickle module
4. All lambda functions have the same name, that is, <lambda>
Posted Date:-2022-01-02 10:03:01
Pick the correct statement regarding pickle and marshal modules.
1.The pickle module supports primarily .pyc files whereas marshal module is used to sterilize Python objects
2.The pickle module keeps track of the objects that have already been sterilized whereas the marshal module does not do this
3.The pickle module cannot be used to sterilize user defined classes and their instances whereas marshal module can be used to perform this task
4. The format of sterilization of the pickle module is not guaranteed to be supported across all versions of Python. The marshal module sterilization is compatible across all the versions of Python
Posted Date:-2022-01-02 09:58:15
The copy module uses the ________ protocol for shallow and deep copy.
1. pickle
2.marshal
3.shelve
4.copyreg
Posted Date:-2022-01-02 10:03:59
The difference between the functions re.sub and re.subn is that re.sub returns a _______ whereas re.subn returns a ______
1.string, list
2. list, tuple
3. string, tuple
4.tuple, list
Posted Date:-2022-01-02 10:30:25
The expression a{5} will match _____ characters with the previous regular expression.
1. 5 or less
2.exactly 5
3. 5 or more
4.exactly 4
Posted Date:-2022-01-02 10:13:46
The function of re.search is ____
1.Matches a pattern at the start of the string
2.Matches a pattern at the end of the string
3.Matches a pattern from any part of a string
4. Such a function does not exist
Posted Date:-2022-01-02 10:33:35
The module _____ is a comparatively faster implementation of the pickle module.
1.cPickle
2.nPickle
3.gPickle
4.tPickle
Posted Date:-2022-01-02 10:03:26
The special character B matches the empty string, but only when it is ____
1.at the beginning or end of a word
2.not at the beginning or end of a word
3.at the beginning of the word
4.at the end of the word
Posted Date:-2022-01-02 10:36:00
To sterilize an object hierarchy, the _____________ function must be called. To desterilize a data stream, the ______________ function must be called.
1.dumps(), undumps()
2.loads(), unloads()
3.loads(), dumps()
4.dumps(), loads()
Posted Date:-2022-01-02 09:57:40
What does the function re.match do?
1.matches a pattern at the start of the string
2.matches a pattern at any position in the string
3.such a function does not exist
4. None of the mentioned
Posted Date:-2022-01-02 10:06:09
What does the function re.search do?
1.matches a pattern at the start of the string
2.matches a pattern at any position in the string
3.such a function does not exist
4. None of the mentioned
Posted Date:-2022-01-02 10:06:38
What will be the output of the following Python code? import re re.ASCII
1.8
2.32
3. 64
4.256
Posted Date:-2022-01-02 10:17:38
What will be the output of the following Python code? pickle.HIGHEST_PROTOCOL
1.4
2.5
3.3
4.6
Posted Date:-2022-01-02 09:59:07
What will be the output of the following Python code? re.compile('hello', re.X)
1.[‘h’, ‘e’, ‘l’, ‘l’, ‘o’]
2.re.compile(‘hello’, re.VERBOSE)
3. Error
4.Junk value
Posted Date:-2022-01-02 10:21:16
What will be the output of the following Python code? re.escape('new**world')
1. ‘new world’
2. ‘new\*\*world’
3.‘**’
4. ‘new’, ‘*’, ‘*’, ‘world’
Posted Date:-2022-01-02 10:28:58
What will be the output of the following Python code? re.fullmatch('hello', 'hello world')
1. No output
2.[]
3.<_sre.SRE_Match object; span=(0, 5), match='hello'>
4. error
Posted Date:-2022-01-02 10:29:41
What will be the output of the following Python code? re.match('sp(.*)am', 'spam')
1.<_sre.SRE_Match object; span=(1, 4), match=’spam’>
2. <_sre.SRE_Match object; span=(0, 4), match=’spam’>
3.No output
4.Error
Posted Date:-2022-01-02 10:37:42
What will be the output of the following Python code? re.split('W+', 'Hello, hello, hello.')
1. [‘Hello’, ‘hello’, ‘hello.’]
2.[‘Hello, ‘hello’, ‘hello’]
3.[‘Hello’, ‘hello’, ‘hello’, ‘.’]
4.[‘Hello’, ‘hello’, ‘hello’, â€]
Posted Date:-2022-01-02 10:14:48
What will be the output of the following Python code? re.split(r'(nd)=', 'n1=3.1, n2=5, n3=4.565')
1.Error
2.[â€, ‘n1’, ‘3.1, ‘, ‘n2’, ‘5, ‘, ‘n3’, ‘4.565’]
3. [‘n1’, ‘3.1, ‘, ‘n2’, ‘5, ‘, ‘n3’, ‘4.565’]
4. [‘3.1, ‘, ‘5, ‘, ‘4.565’]
Posted Date:-2022-01-02 10:33:05
What will be the output of the following Python code? re.sub('morning', 'evening', 'good morning')
1. ‘good evening’
2. ‘good’
3.‘morning’
4.‘evening’
Posted Date:-2022-01-02 10:28:21
What will be the output of the following Python code? s = 'welcome home' m = re.match(r'(.*)(.*?)', s) print(m.group())
1.(‘welcome’, ‘home’)
2. [‘welcome’, ‘home’]
3.welcome home
4. [‘welcome’ // ‘home’ ]
Posted Date:-2022-01-02 10:34:59
What will be the output of the following Python code? sentence = 'horses are fast' regex = re.compile('(?P<animal>w+) (?P<verb>w+) (?P<adjective>w+)') matched = re.search(regex, sentence) print(matched.group(2))
1. {‘animal’: ‘horses’, ‘verb’: ‘are’, ‘adjective’: ‘fast’}
2.(‘horses’, ‘are’, ‘fast’)
3. ‘horses are fast’
4.‘are’
Posted Date:-2022-01-02 10:11:56
What will be the output of the following Python code? sentence = 'horses are fast' regex = re.compile('(?P<animal>w+) (?P<verb>w+) (?P<adjective>w+)') matched = re.search(regex, sentence) print(matched.groupdict())
1. {‘animal’: ‘horses’, ‘verb’: ‘are’, ‘adjective’: ‘fast’}
2. (‘horses’, ‘are’, ‘fast’)
3.horses are fast’
4. ‘are’
Posted Date:-2022-01-02 10:08:46
What will be the output of the following Python code? sentence = 'we are humans' matched = re.match(r'(.*) (.*?) (.*)', sentence) print(matched.group(2))
1.‘are’
2.‘we’
3.‘humans’
4.‘we are humans’
Posted Date:-2022-01-02 10:08:17
What will be the output of the following Python code? sentence = 'we are humans' matched = re.match(r'(.*) (.*?) (.*)', sentence) print(matched.groups())
1. (‘we’, ‘are’, ‘humans’)
2. (we, are, humans)
3. (‘we’, ‘humans’)
4.‘we are humans’
Posted Date:-2022-01-02 10:07:19
Which module in Python supports regular expressions?
1. re
2. regex
3.pyregex
4.none of the mentioned
Posted Date:-2022-01-02 10:05:18
Which of the following cannot be pickled?
1.Functions which are defined at the top level of a module with lambda
2.Functions which are defined at the top level of a module with def
3. Built-in functions which are defined at the top level of a module
4.Classes which are defined at the top level of a module
Posted Date:-2022-01-02 10:02:10
Which of the following creates a pattern object?
1.re.create(str)
2.re.regex(str)
3.re.compile(str)
4.re.assemble(str)
Posted Date:-2022-01-02 10:05:45
Which of the following functions can accept more than one positional argument?
1.pickle.dumps
2.pickle.loads
3.pickle.dump
4. pickle.load
Posted Date:-2022-01-02 10:00:31
Which of the following functions can be used to find the protocol version of the pickle module currently being used?
1.pickle.DEFAULT
2.pickle.CURRENT
3.pickle.CURRENT_PROTOCOL
4.pickle.DEFAULT_PROTOCOL
Posted Date:-2022-01-02 10:00:02
Which of the following functions clears the regular expression cache?
1.re.sub()
2. re.pos()
3.re.purge()
4.re.subn()
Posted Date:-2022-01-02 10:16:56
Which of the following functions results in case insensitive matching?
1. re.A
2. re.U
3. re.I
4.re.X
Posted Date:-2022-01-02 10:18:00
Which of the following pattern matching modifiers permits whitespace and comments inside the regular expression?
1. re.L
2. re.S
3.re.U
4.re.X
Posted Date:-2022-01-02 10:34:32
Which of the following Python codes will result in an error? object = ‘a’
1. >>> pickle.dumps(object)
2. >>> pickle.dumps(object, 3)
3.>>> pickle.dumps(object, 3, True)
4.>>> pickle.dumps(‘a’, 2)
Posted Date:-2022-01-02 09:59:37
Which of the following special characters matches a pattern only at the end of the string?
1. B
2.X
3.
4.A
Posted Date:-2022-01-02 10:36:29
Which of the following special characters represents a comment (that is, the contents of the parenthesis are simply ignores)?
1.(?:…)
2.(?=…)
3.(?!…)
4.(?#…)
Posted Date:-2022-01-02 10:38:26
______ matches the start of the string. ________ matches the end of the string.
1. ‘^’, ‘$’
2. ‘$’, ‘^’
3. ‘$’, ‘?’
4. ‘?’, ‘^’
Posted Date:-2022-01-02 10:14:13